<?php
include_once "xAP-functions/webincludes.php";




$results=dbquery("Select distinct Category from xAP_News_Source order by Category");
foreach($results as $r){
	$cat[]=array("title"=>$r["Category"],"function"=>"Category","id"=>$r["Category"]);
}

$results=dbquery("Select SourceID,Alias from xAP_News_Source order by Alias");
foreach($results as $r){
	$item[]=array("title"=>$r["Alias"],"function"=>"NewsLoad","id"=>$r["SourceID"]);
}



?>
[
{'text': "<a href='#' OnClick='NewsLoad(0)'>Latest</a>",'classes': 'boldtext', 'expanded':'true'},
{'text': 'Categories','classes': 'boldtext', 'expanded':'true','children':[
<?foreach($cat as $key=>$v):?>
{'text': "<a href='#' OnClick=\"<?=$v["function"]?>('<?=$v["id"]?>')\"><?=$v["title"]?></a>",'classes': 'normaltext'},
<? endforeach;?>
]},
{'text': 'Feeds','classes': 'boldtext', 'children':[
<?foreach($item as $key=>$v):?>
{'text': "<a href='#' OnClick=\"<?=$v["function"]?>('<?=$v["id"]?>')\"><?=$v["title"]?></a>",'classes': 'normaltext'},
<? endforeach;?>
]},
]